<template>
  <!-- <bi-sidebar-layout
    :title="route.title"
    :name="route.id"
  > -->
  <bi-sidebar-layout
    :title="settingMenuItem ? settingMenuItem.title : ''"
  >
    <template slot="sidebar">
      <ui-menu>
        <ui-menu-item
          v-for="menu in menuData"
          :key="menu.id"
          :url="menu.fullPath"
        >
          {{ menu.title }}
        </ui-menu-item>
      </ui-menu>
    </template>
    <router-view></router-view>
  </bi-sidebar-layout>
</template>
<script>
import BiSidebarLayout from '../../common/sidebar-layout' 

export default {
  name: 'AppSidemenu',
  components: {
    BiSidebarLayout
  },
  computed: {
    settingRoute () {
      return this.$platform.getClosestRoutes(this.$route.meta.$id).find(v => v._settingRoute === true)
    },
    settingMenuItem () {
      if (!this.settingRoute) {
        return
      }
      return this.$platform.getMenuItemByRouteId(this.settingRoute.id)
    },
    menuData () {
      if (!this.settingRoute) {
        return []
      }
      return (this.settingRoute.children || []).map(v => {
        return this.$platform.getMenuItemByRouteId(v.id)
      })
    }
  }
}
</script>
<style lang="less">
</style>
